<template>
	<view>
		<view>
			<myHead :title="title" />
			<view class="content">
				<uni-swiper-dot :info="info" :current="current" :mode="mode" :dotsStyles="dotsStyles" field="content" mode="nav">
					<swiper class="swiper-box" @change="change">
						<swiper-item v-for="(item ,index) in info" :key="index" >
							<view class="swiper-item">
								<image style="width:100%; height:200px; background-color: #eeeeee;" 
									:src="item.fileUrl"></image>
									 {{item.content}}
							</view>
						</swiper-item>
					</swiper>
				</uni-swiper-dot>

				<uni-list>
					<list-item class="banner">
						公告
					</list-item>
					<!-- 显示关闭按钮 -->
					<uni-notice-bar showIcon="true" :text="notice.noticeContent">
					</uni-notice-bar>
				</uni-list>

				<uni-list>
					<p class="banner ">
						其他服务
					</p>
					<uni-list-item class="list-p" style="padding:0;height: 0"></uni-list-item>
					<uni-list-item title="求是排名" link to="/pages/vue/index/index" @click="onClick(true)"></uni-list-item>
					<uni-list-item title="每日一题" link to="/pages/knowledge/dayTest/index" @click="onClick(false)">
					</uni-list-item>
				</uni-list>
			</view>
		</view>

		<view>
			<myFooter :isSelected.sync="selected" />
		</view>
	</view>
</template>

<script>
	import {
		downBanner,
		downNotice
	} from '@/api/api_notice.js'
	import NetWorkTool from '@/api/netWorkTool'
	import myHeader from '../components/index_header.vue'
	import myFooter from '../components/index_footer.vue'
	import {
		getMenu
	} from '../../api/api_index'
	export default {
		data() {
			return {
				title: "首页",
				content: "首页公告",
				value: "",
				selected: 'index',
				allUrl: '',
				info: [],
				current: 0,
				mode: 'nav',
				dotsStyles: {
					bottom: 5,
					color: "#FFF",
				},
				notice: {}
			}
		},
		components: {
			myHead: myHeader,
			myFooter: myFooter
		},
		onShow() {
			downBanner().then(res => {
				this.info = res
			})

		},
		methods: {},
		onReady() {
			getMenu().then(res => { //获取菜单
				uni.setStorage({
					key: 'menuMap',
					data: res
				});
			})
		},
		created() {

			// NetWorkTool.GET('/api/downloadBgBase64').then(res=>{
			// 	this.bgImgUrl =res 
			// 	uni.setStorage({
			// 		key:'hall',
			// 		data:res
			// 	})
			// });
			// NetWorkTool.GET('/api/loginBgBase64').then(res=>{ 
			// 	this.bgImgUrl =res 
			// 	uni.setStorage({
			// 		key:'loginImg',
			// 		data:res,
			// 		success() {
			// 		this.bgImgUrl = uni.getStorageSync("loginImg")	
			// 		}
			// 	})
			// });
			downNotice().then(res => {
				this.notice = res[0]
			})
		},
		methods: {
			change(e) {
				this.current = e.detail.current;
			},
			onClick(ars) {
				if (ars) {
					uni.navigateTo({
						url: '../paihang/paihang'
					})
				} else { //每日一题

				}
			}
		}
	}
</script>
<style lang="scss" scoped>
	.content {
		width: 90%;
		margin: 0 auto;
		margin-top: 50upx;

		>/deep/ .uni-swiper__warp {
			uni-image {
				// margin:0 auto;

			}
		}

		/deep/ .uni-list {
			.uni-list-chat {
				margin: 20upx 0 !important;
			}
		}

		.banner {
			margin: 5% 0;
			font-size: 35upx;

			&::before {
				width: 4px;
				height: 100%;
				background-color: #e20909;
				content: '\00A0';
				margin: 4px;
			}
		}
	}
</style>
